package helper

import (
	"fmt"
	"github.com/snluu/uuid"
	"os"
	"time"
)

//新创建UUID
func NewUUID() string {
	return uuid.Rand().Hex()
}

//检测文件路径是否存在
func ExistsPath(path string) (bool, error) {
	_, err := os.Stat(path)
	if err == nil {
		return true, nil
	}
	if os.IsNotExist(err) {
		return false, nil
	}
	return false, err
}

// 监测程序执行时间
func Stopwatch(start time.Time) {
	cost := time.Since(start)
	fmt.Println("耗时:", cost)
}